package com.wbc.demo;

import org.openjdk.jol.info.ClassLayout;

/**
 *
 * 需要引入依赖
 *       <dependency>
 *             <groupId>org.openjdk.jol</groupId>
 *             <artifactId>jol-core</artifactId>
 *             <version>0.16</version>
 *         </dependency>
 * @author wangbingchen
 * @DATE: 2022/8/21
 */


class User{}

/**
 * 用户观察 对象在 JVM 中占用大小
 */
public class JVMDemo {


    public static void main(String[] args) {

        User user = new User();
        System.out.println(ClassLayout.parseInstance(user).toPrintable());

        System.out.println("--------------------------------------------------");

        User[] users = new User[10];
        System.out.println(ClassLayout.parseInstance(users).toPrintable());
    }

}
